package com.xiaozhen.rtmp.service;

import com.xiaozhen.rtmp.common.CacheMap;
import com.xiaozhen.rtmp.domain.Camera;
import com.xiaozhen.rtmp.thread.MediaTransferHls;

import java.io.InputStream;
import java.util.concurrent.ConcurrentHashMap;

/**
 * HISTORY
 *
 * @author zhenweisheng
 * @date 2021/12/6 16:29
 * @description:
 */
public interface HlsService {

    /**
     *
     */
    ConcurrentHashMap<String, MediaTransferHls> cameras = new ConcurrentHashMap<>();
    /**
     * 定义ts缓存10秒
     */
    CacheMap<String, byte[]> cacheTs = new CacheMap<>(10000);
    CacheMap<String, byte[]> cacheM3u8 = new CacheMap<>(10000);
    /**
     *
     * @param mediaKey
     * @param tsName
     * @param in
     */
    void processTs(String mediaKey, String tsName, InputStream in);

    /**
     *
     * @param mediaKey
     * @param in
     */
    void processHls(String mediaKey, InputStream in);
    /**
     *
     * @param cameraDto
     */
    void closeConvertToHls(Camera cameraDto);
    /**
     * 开始hls切片
     *
     * @param camera
     * @return
     */
    boolean startConvertToHls(Camera camera);
}
